package com.ncst.newsfragment;

import android.content.Context;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.ncst.coursecode.R;

public class NewsContentActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.news_content);
        String newsTitle=getIntent().getStringExtra("news_title");
        String newsContent=getIntent().getStringExtra("news_content");
        ((NewsContentFragment) getSupportFragmentManager()
                .findFragmentById(R.id.news_content_fragment))
                .refresh(newsTitle,newsContent);

    }
     public static void actionStart(Context context,String newsTitle,String newsContent){
         Intent intent=new Intent(context,NewsContentActivity.class);
         intent.putExtra("news_title",newsTitle);
         intent.putExtra("news_content",newsContent);
         context.startActivity(intent);
     }
}
